/* AI智能分析页面专用样式 */

/* 返回按钮样式 */
.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

/* 主要内容区域 */
.ai-main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* 通用卡片样式 */
.section-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.section-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 数据选择区域 */
.data-selection-section {
    width: 100%;
}

.data-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* 数据选项 */
.data-option {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.data-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.data-option.selected {
    border-color: rgba(78, 205, 196, 0.8);
    background: rgba(78, 205, 196, 0.1);
}

.option-icon {
    font-size: 32px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.option-content {
    flex: 1;
    position: relative;
}

.option-content h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #fff;
}

.option-content p {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.record-count {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.option-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4ECDC4;
    font-size: 14px;
    align-self: center;
}

.data-option.selected .option-checkbox {
    background: rgba(78, 205, 196, 0.3);
}

/* 浏览按钮 */
.browse-btn {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s;
}

.browse-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 确保浏览按钮不会触发卡片选择 */
.browse-btn {
    position: relative;
    z-index: 10;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.analyze-btn, .clear-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.analyze-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.clear-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.clear-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

/* 分析进度显示 */
.analysis-progress {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(78, 205, 196, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(10px);
    animation: slideInUp 0.5s ease-out;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progress-header h4 {
    color: #4ECDC4;
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.progress-stats {
    color: #B0BEC5;
    font-size: 14px;
    font-weight: bold;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ECDC4, #44A08D, #4ECDC4);
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.progress-percentage {
    color: #4ECDC4;
    font-weight: bold;
    font-size: 14px;
    min-width: 40px;
    text-align: right;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.current-task {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
}

.task-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.task-name {
    font-weight: 500;
}

.estimated-time {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #B0BEC5;
    font-size: 12px;
}

.time-icon {
    animation: tick 1s infinite;
}

@keyframes tick {
    0%, 50% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.time-text {
    font-weight: 400;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 分析结果区域 */
.results-section {
    width: 100%;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.export-pdf-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-pdf-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.export-pdf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.export-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.export-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.chart-container {
    margin-bottom: 2rem;
}

.chart-container h4 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.analysis-chart {
    width: 100%;
    height: 600px; /* 从400px增加到600px */
    min-height: 500px; /* 设置最小高度 */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.analysis-reports {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.analysis-report {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.report-header h4 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.report-type {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

.fallback-indicator {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
    cursor: help;
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.analysis-text {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    white-space: pre-wrap;
}



.send-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 智能对话样式 */
.chat-section {
    margin-top: 2rem;
}

.chat-input-area {
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-send-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.chat-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 对话历史区域 */
.chat-history-area {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.empty-chat {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 2rem;
}

.empty-chat p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.empty-chat ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.empty-chat li {
    padding: 0.5rem 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    padding: 1rem;
    border-radius: 12px;
    max-width: 85%;
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.message-sender {
    font-weight: 600;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.6;
}

.message-content {
    line-height: 1.6;
    white-space: pre-wrap;
}

.loading-message .message-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 滚动条样式 */
.chat-history-area::-webkit-scrollbar {
    width: 6px;
}

.chat-history-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-history-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-history-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
    word-wrap: break-word;
    font-size: 0.95rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-main {
        padding: 1rem;
    }

    .data-options {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .analyze-btn, .clear-btn {
        width: 100%;
    }

    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .chat-send-btn {
        width: 100%;
    }

    /* 移动端图表优化 */
    .analysis-chart {
        height: 450px; /* 移动端稍微减小高度 */
        min-height: 400px;
    }
}

/* 大屏幕图表优化 */
@media (min-width: 1200px) {
    .analysis-chart {
        height: 700px; /* 大屏幕进一步增大图表 */
        min-height: 600px;
    }
}

/* 超大屏幕图表优化 */
@media (min-width: 1600px) {
    .analysis-chart {
        height: 800px; /* 超大屏幕最大化图表 */
        min-height: 700px;
    }
}
